<template>
	<div class="back_contain_n">
		<!-- 头部搜索 -->
		<div class="Search_Top_Part">
			<div class="search_list">
				<div>
					<div class="input_flex daterange">
						<el-input disabled clearable v-model="headInfo.dutyDay" placeholder="班次"></el-input>
					</div>
					<div class="input_flex">
						<el-input disabled clearable v-model="headInfo.whiteDay =='1'?'白班':'夜班'" placeholder="班次"></el-input>
					</div>
					<div class="input_flex">
						<el-input disabled clearable v-model="headInfo.banzhang" placeholder=""></el-input>
					</div>
				</div>
			</div>
		</div>
		<!-- table -->
		<sys-table
			:tableData="linePeis"
			:tableLoading="tableLoading"
			:tableHeader="tableHeader"
			:isOperate="false" :isPagination="false"
		>
		</sys-table>
	</div>
</template>

<script>
	export default {
		data() {
			return {
				tableLoading: true, //table刷新
				tableHeader: [],
				headInfo:{banzhang:'',whiteDay:'',dutyDay:''},
				linePeis:[],
			}
		},
		methods: {
			getLinePeiListMap() {
				let self = this;
				self.headInfo = {banzhang:'',whiteDay:'',dutyDay:''};
				self.linePeis = [];
				self.tableLoading = true;
				self.$http({
					url: "/jinl/linepei/getLinePeiListMap",
					method: "post",
				}).then(resp => {
					if (resp.success) {
						console.log(resp.result)
						self.tableHeader = [
							{"columnValue": "deviceCode", "columnName": "罐号"},
							{"columnValue": "gpName", "columnName": "管坯名称"},
							{"columnValue": "zlValue", "columnName": "主料(kg)"},
							{"columnValue": "flValue", "columnName": "辅料(kg)"},
							{"columnValue": "smValue", "columnName": "色母(kg)"},
							{"columnValue": "ratios", "columnName": "配比"},
							{"columnValue": "totalValue", "columnName": "总料重(kg)"},
							{"columnValue": "plUserName", "columnName": "配料人"},
							{"columnValue": "banTimePeriod", "columnName": "拌料时段"},
							{"columnValue": "banTimeCount", "columnName": "搅拌时长(min)"},
							{"columnValue": "plStatusCn", "columnName": "状态"},
							{"columnValue": "unOutValue", "columnName": "未出料(kg)"},
						];
						self.linePeis = resp.result.linePeis||[];
						for(let data of self.linePeis){
							let totalValue = data.totalValue;
							let unOutValue = data.unOutValue;
							if(totalValue&&unOutValue){
								unOutValue = parseFloat(totalValue) - parseFloat(unOutValue);
								data.unOutValue = unOutValue.toFixed(2);
							}
						}
						self.headInfo.dutyDay = resp.result.dutyDay;
						self.headInfo.whiteDay = resp.result.whiteDay;
						self.headInfo.banzhang = resp.result.banzhang;
					}
					self.tableLoading = false;
				});
			},
		},
		mounted() {
			let self = this;
			self.getLinePeiListMap();
		},
		components: {},
	}
</script>

<style lang="scss" scoped>
	@import "@/style/SearchTop.scss";
</style>